//
//  HZ_ViewController.m
//  HZ_Beautiful_Music
//
//  Created by dllo on 16/3/30.
//  Copyright © 2016年 ui. All rights reserved.
//

#import "HZ_ViewController.h"

@interface HZ_ViewController ()

@end

@implementation HZ_ViewController


- (void)dealloc {
    
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}





- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor clearColor];
    
    NSString *state = [[NSUserDefaults standardUserDefaults] objectForKey:@"night"];
    if ([state isEqualToString:@"yes"]) {
        self.view.backgroundColor = [UIColor colorWithRed:49 / 255.0 green:47 / 255.0 blue:53 / 255.0 alpha:1];
    }else {
        self.view.backgroundColor = [UIColor clearColor];
    }

    NSNotificationCenter *centerTWO = [NSNotificationCenter defaultCenter];

    [centerTWO addObserver:self selector:@selector(buttonNotification:) name:@"heibai" object:nil];

}

- (void)buttonNotification:(NSNotification *)notification{
    UIColor *color = [notification object];
    self.view.backgroundColor = color;
    if (color == [UIColor clearColor]) {
        self.view.backgroundColor = [UIColor clearColor];
    }else {
        self.view.backgroundColor = [UIColor colorWithRed:49 / 255.0 green:47 / 255.0 blue:53 / 255.0 alpha:1];
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
